body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px;
    background-color: #f4f4f4;
}

h1 {
    color: #333;
}

.controls {
    /* 元素居中显示 */
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    padding: 10px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    
} 

.output-controls {
    margin-bottom: 20px;
    padding: 10px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 50%;
    display: flex;
    justify-content: center;
}

.controls label, .controls input, .controls button {
    margin: 5px;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.output-controls button, .output-controls textarea {
    margin: 5px;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.controls input[type="number"] {
    width: 60px;
}

.controls button, .output-controls button {
    background-color: #007bff;
    color: white;
    cursor: pointer;
    border: none;
}

.controls button:hover, .output-controls button:hover {
    background-color: #0056b3;
}

#gridContainer {
    display: grid;
    border: 1px solid #ccc;
    background-color: #fff;
    margin-bottom: 20px;
    font-family: 'Courier New', Courier, monospace; /* Monospaced font for grid */
    line-height: 1; /* Ensure cells are compact */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: auto; /* Add scroll for very large grids */
    max-width: 90vw; /* Prevent very wide grids from breaking layout */
}

.grid-cell {
    box-sizing: border-box;
    width: 20px;
    height: 20px;
    border: 1px solid #eee;
    text-align: center;
    cursor: pointer;
    user-select: none;
    font-size: 14px; /* Ensure character fits well */
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-cell:hover {
    background-color: #e9e9e9;
}

#asciiOutput {
    width: 90%;
    font-family: 'Courier New', Courier, monospace;
    white-space: pre; /* Preserve whitespace and newlines */
    background-color: #eef;
    border: 1px solid #ccc;
}

/* 新增样式 */
.ascii-display-area {
    width: 100%;
    /* max-width: 700px; */
    font-family: 'Courier New', Courier, monospace;
    background-color: #f8f9fa;
    border: 1px solid #ccc;
    padding: 10px;
    margin: 5px;
    border-radius: 4px;
    
}

.ascii-line-container {
    display: flex;
    align-items: center;
    justify-content: space-between; /* 使文本和按钮分布在两端 */
    padding: 2px 0; /* 微调行间距 */
    border-bottom: 1px dashed #eee; /* 每行之间的分隔线，可选 */
}

.ascii-line-container:last-child {
    border-bottom: none; /* 最后一行不需要分隔线 */
}

.ascii-line-text {
    margin: 0; /* pre 标签默认有 margin，重置它 */
    padding-right: 10px; /* 文本和按钮之间留些空间 */
    white-space: pre; /* 确保保留文本中的空格 */
    flex-grow: 1; /* 让文本区域占据多余空间 */
}

.copy-line-btn {
    padding: 4px 8px;
    font-size: 12px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 10px; /* 按钮和文本之间的间隔 */
    white-space: nowrap; /* 防止按钮文字换行 */
}

.copy-line-btn:hover {
    background-color: #5a6268;
} 